wxapp.model.SceneInfo = cc.Class.extend({
    UI_STATE: {
        UI_STATE_LOADING1: "ui_state_loading1",
        UI_STATE_LOADING2: "ui_state_loading2",
        UI_STATE_LOADING3: "ui_state_loading3",
        UI_STATE_LOBBY: "ui_state_lobby",
        UI_STATE_GAME: "ui_state_game",
        UI_STATE_ORTHER: "ui_state_orther"
    },
    ctor: function() {
        this._uiState = this.UI_STATE.UI_STATE_ORTHER, this.History_params = [], this.finish_params = [], 
        this.cacheSceneParam = null, this.lastEnterInfo = 0, this.shareClick = null, tywx.NotificationCenter.listen(tywx.EventType.GAME_SHOW, this.onGameShow, this), 
        tywx.NotificationCenter.listen(tywx.EventType.GAME_HIDE, this.onGameHide, this);
    },
    release: function() {
        tywx.NotificationCenter.ignore(tywx.EventType.GAME_SHOW, this.onGameShow, this), 
        tywx.NotificationCenter.ignore(tywx.EventType.GAME_HIDE, this.onGameHide, this);
    },
    setUiState: function(t) {
        this._uiState = t;
    },
    getUiState: function() {
        return this._uiState;
    },
    addHistoryParam: function(t) {
        this.History_params.push(t);
    },
    addCacheParam: function(t) {
        t && t.query && t.query.fishType && (this.cacheSceneParam = t);
    },
    getCacheParam: function() {
        return this.cacheSceneParam;
    },
    commitCacheParam: function() {
        null != this.cacheSceneParam && (this.finish_params.push(this.cacheSceneParam), 
        this.cacheSceneParam = null);
    },
    saveSceneInfo: function(t) {
        wxapp.model.sceneInfo.addHistoryParam(t);
        var e = t, a = t.scene, n = t.query, i = (t.shareTicket, "");
        if (tywx.showScene = a, tywx.showQuery = n, tywx.UserInfo.scene_id = a, tywx.UserInfo.scene_param = n.from || "", 
        tywx.UserInfo.invite_id = n.inviteCode || 0, 0 != a && (this.lastEnterInfo = a), 
        n && n.gdt_vid && n.weixinadinfo) {
            var o = "gdt." + n.weixinadinfo;
            tywx.UserInfo.scene_param = o, tywx.BiLog.clickStat(tywx.clickStatEventType.clickStatEventTypeUserFrom, [ a, o ]);
        } else n && n.sourceCode ? wxapp.tools.bilog.clickStat(tywx.clickStatEventType.clickStatEventTypeUserFrom, [ a, n.inviteCode, n.sourceCode, n.imageType, "CardActive" ]) : tywx.Util.isSceneQrCode(a) ? (n.hasOwnProperty("scene") ? i = n.scene : e.hasOwnProperty("path") && (i = e.path), 
        i.replace(".html", ""), i = decodeURIComponent(i), tywx.UserInfo.scene_param = i, 
        wxapp.tools.bilog.clickStat(tywx.clickStatEventType.clickStatEventTypeUserFrom, [ a, i ])) : wxapp.tools.bilog.clickStat(tywx.clickStatEventType.clickStatEventTypeUserFrom, [ a, n.from ]);
        if (n && n.inviteCode && (wxapp.model.sceneInfo.addCacheParam(t), n.udata)) try {
            var r = JSON.parse(n.udata), s = r.udata;
            for (var c in s) {
                var p = s[c];
                if (r[p]) {
                    var h = r[p];
                    wxapp.configure.set(p, h), wxapp.configure.set("roomId", n.roomId);
                }
            }
        } catch (t) {}
    },
    startLaunchOption: function() {
        var t = wx.getLaunchOptionsSync();
        this.saveSceneInfo(t);
    },
    onGameShow: function(t) {
        this.saveSceneInfo(t);
    },
    onGameHide: function() {
        tywx.UserInfo.scene_id = 0;
    },
    print: function() {},
    printInfo: function() {
        if (wxapp.debugLog) {
            var t = this.getCacheParam();
            if (null != t) {
                var e = t.query, a = "";
                a = wxapp.appData.stateInfo.networkConnected ? "网络连接" : "网络断开", e.inviteCode == wxapp.appData.userInfo.userId && wxapp.twarn("app", "print参数信息", "同一个用户的分享", a), 
                1 == e.fishType ? wxapp.twarn("app", "print参数信息", "要进入到大厅", a) : wxapp.twarn("app", "print参数信息", "要进入到游戏", a, e.roomId, e.tableId);
                try {
                    var n = newfish.model.table.roomId, i = newfish.model.table.tableId;
                    wxapp.twarn("app", "print参数信息", "newfish.model.table数据", n, i);
                } catch (t) {}
            } else wxapp.twarn("app", "print参数信息", "无参数");
        }
    }
});